home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Readers / Gui4Cli / Docs / FastRead.guide (.txt) < prev    next >
Amigaguide Document  |  1997-12-02  |  17KB  |  349 lines

  1. @databse HelpSysDoc
  2. @node Introduction
  3.                        FASTREAD.GC DOCUMENTATION
  4. INTRODUCTION
  5.     FastRead.gc is a gui which provides an easy method to access
  6. documentation either completely, in reader mode, or by fetching
  7. selected patches of text for online help from within a Gui4Cli user's
  8. own program.
  9.     This gives the Gui4Cli user an easier and quicker way than
  10. AmigaGuide to write documentation about his program, and the same
  11. document can also be used for quick help from within the user's own
  12. program, although FastRead.gc can also do these things with AmigaGuide
  13. documents as well as its own, just as easily.
  14.     FastRead.gc works in two modes. Firstly it is able to be used as a
  15. document reader, and secondly as quick help from within a program,
  16. fetching and displaying instructions on individual gadgets. It can do
  17. this because it has a separate reader gui, ViewText.g, which displays
  18. the text.  FastRead.gc handles the preprocessing of documents and
  19. displays the index, so is not needed when only online help is
  20. required.  ViewText.g handles this part.
  21. @endnode 
  22. @node Requirements
  23. REQUIREMENTS
  24.     The Gui4Cli help system needs no special support libraries or
  25. files, and only needs Gui4Cli installed on the system. The work is
  26. done by two binary files, GetNodes and WriteNode, which are a part of
  27. the Gui4Cli distribution.
  28. @endnode 
  29. @node "Where Things Are"
  30. THE FASTREAD DIRECTORY TREE
  31.     Until you are familiar enough with FastRead.gc and its associated
  32. programs to be able to take it and use it for your own purposes, you
  33. may find it helpful to know where things are in relation to your
  34. overall directory structure. You need Gui4Cli to be installed in your
  35. system, and it will use the directory GUIS: as its home base. Within
  36. that environment, FastRead.gc and its friends are located thus :
  37.   GUIS:                      ;Home base for Gui4Cli
  38.     |
  39.     |___Docs                 ;Gui4Cli directory for documents. eg,
  40.     |                        ;HelpSystem.txt (the file you are
  41.     |                        ;reading now), plus any further docs,
  42.     |                        ;guides, etc. which you collect or 
  43.     |                        ;create.
  44.     |
  45.     |___C                    ;Gui4Cli directory for binaries. GetNodes
  46.     |                        ;and WriteNode are stored in here.
  47.     |
  48.     |___Tools                ;Gui4Cli directory for global tools, such
  49.           |                  ;as FastRead.
  50.           |
  51.           |___FastRead       ;FastRead.gc, ViewText.g, HelpDemo.gc
  52.                   |          ;and related icons.
  53.                   |
  54.                   |___Idx    ;Directory to hold index files as
  55.                              ;created by FastRead.gc.
  56. @endnode
  57. @node "The GCHELP: Assign"
  58. THE GCHELP: ASSIGN
  59.     For general convenience, the directory name GCHELP: is temporarily
  60. assigned to whatever directory holds FastRead.gc or any of its
  61. associated programs. The assignment is created by the FastRead.gc
  62. suite of programs when any of them start up, and is removed again when
  63. the programs end. The assign will have no effect on anything else you
  64. @endnode 
  65. @node "Writing Your Docs"
  66. WRITING A DOCUMENT
  67.     As with AmigaGuide, the doc file is written in any text editor.
  68. The difference is that unlike AmigaGuide, the Gui4Cli help system does
  69. not require the insertion of complex formatting codes. Only three
  70. codes are used - '@node' and '@endnode', to mark the start and end of
  71. various topics that the user wants to access, and a '@database'
  72. header. These are the same markers as AmigaGuide uses. FastRead.gc
  73. will strip out all other AmigaGuide formatting codes when reading
  74. AmigaGuide. Text colours and styles are not supported, since the
  75. handling of AmigaGuides by FastRead.gc is there merely to enable the
  76. user to write his docs in either format and still have access to
  77. online help.
  78.     A document which is intended for access by FastRead.gc needs some
  79. preparatory editing. The file you are now reading has examples of such
  80. editing included. Each section of text which you want to appear in the
  81. index must begin with '@node' and end with '@endnode'. It's as simple
  82. as that. A short title must be placed after '@node'. This is the
  83. subject title which will appear in the FastRead lister.  If the title
  84. contains spaces, enclose it in double quotes. The same applies to the
  85. database title.
  86.     For the purposes of this text, let the | character represent the
  87. extreme left of your editing window. Then the layout of your document
  88. might look like this :
  89.     |@database <title>
  90.     |@node Introduction
  91.     |
  92.     |(Introductory text)
  93.     |
  94.     |@endnode
  95.     |
  96.     |@node "Contacting the author"
  97.     |
  98.     |(Text about the author)
  99.     |
  100.     |@endnode
  101. The first line in a document must be a '@database' statement, and the
  102. last line an endnode statement.
  103. @endnode
  104. @node "The Index File"
  105. THE INDEX FILE
  106.     When your document has been written, and FastRead.gc reads this or
  107. an AmigaGuide file for the first time, an index file will be created
  108. automatically, and stored in the 'GUIS:Tools/FastRead/Lst' drawer.
  109.     The name of the index file will always be the same as the document
  110. it belongs to, with a '.idx' filename extension added. For example, if
  111. your document was called 'MyDoc.guide', the index file would be
  112. created with the name 'MyDoc.guide.idx'.
  113.     The index file is used in the FastRead.gc lister, and it's
  114. contents will look something like this...
  115. Introduction                            38 1047
  116. Requirements                            1114 245
  117.     The numbers are the start and length offsets of the subject text
  118. in bytes, so that FastRead.gc will know where to go to retrieve the
  119. text. These numbers are hidden in the lister, and are used also for
  120. online help within the users program.
  121. @endnode
  122. @node "   Index Format"
  123. FORMATTING THE INDEX
  124.     If your text naturally divides itself into major topics and
  125. subtopics, then subtopics can be indicated by preceding the node
  126. title with, say, three spaces, placed INSIDE the double quotes which
  127. enclose the node title, thus :
  128.     |@node "   Requirements"
  129. The exact number of spaces doesn't matter, but you must be consistent.
  130.     You can indicate sub-subtopics in a similar way. The number of
  131. spaces must be more than the number used for the preceding level, and
  132. should be consistent... 
  133.      |@node Introduction
  134.      |(text .. any number of lines)
  135.      |@endnode 
  136.      |@node Applications
  137.      |(text)
  138.      |@endnode 
  139.      |@node "   Application 1"
  140.      |(text)
  141.      |@endnode 
  142.      |@node "      Refinements A"
  143.      |(text)
  144.      |@endnode 
  145.      |@node "      Refinements B"
  146.      |(text)
  147.      |@endnode 
  148.      |@node "   Application 2"      
  149.      |(text)
  150.      |@endnode 
  151.      |@node Limitations
  152.      |(text)
  153.      |@endnode 
  154.     Note that the subject titles that do not need formatting, and only
  155. consist of one word, have no quotes enclosing them. It would do no
  156. harm to put these node titles in quotes, but would be pointless. The
  157. quotes MUST be there for the other titles in the above example.
  158. @endnode 
  159. @node "The Programs"
  160. THE PROGRAMS
  161.     FastRead.gc is the document reader itself, and can work in two
  162. modes. Stand alone, which will read a whole doc file, and Online,
  163. which fetches selected patches of text, or topics from the doc file.
  164. In Stand Alone mode, FastRead.gc does not need the user's program to
  165. be running, and becomes a text file reader. In Online mode, the
  166. commands to fetch text are sent from the user's program instead of
  167. FastRead.gc.
  168.     ViewText.g is the part of FastRead that actually displays the
  169. text, and runs without FastRead.gc for online help, being controlled
  170. from the user's program.
  171.     HelpDemo.gc is a 'mock up' of the user's program, intended to
  172. demonstrate how FastRead.gc is used from within a Gui4Cli script to
  173. obtain online help.
  174. @endnode 
  175. @node "   The Binaries"
  176.                              THE BINARIES
  177. GetNode:        Usage: GetNodes <source doc> <.idx file>
  178.     This is the program that creates the index file (.idx) for your
  179. documentation. GetNodes will grab all the node titles in your doc and
  180. calculate the starting byte and length of each one. The .idx file is
  181. laid out like this...
  182. --- Title --------------------------- Start & Length -----
  183. Introduction                            38 1047
  184. Requirements                            1114 245
  185. WriteNode:      Usage: WriteNode <document> <start> <length>
  186.     WriteNode uses the start and length numbers in the .idx file
  187. generated by GetNodes to find and grab the required piece of text from
  188. your document. The piece of text is saved to Ram Disk:, and is always
  189. called 'Guide.txt'.
  190. @endnode
  191. @node "   FastRead.gc"
  192. FASTREAD.GC
  193.     This is the actual text reader. FastRead.gc opens two windows when
  194. in Stand Alone mode, the main window with a lister, containing the
  195. various topics and subtopics of the doc file, and the text window,
  196. which displays the actual text of the topic or subtopic.
  197.     On loading, FastRead.gc presents a file requester from which the
  198. doc file to be read is chosen. After the file has been chosen, the
  199. lister will display the topics and subtopics. A new document can be
  200. loaded at any time via the 'Open' button.
  201.     Clicking with the left mouse button on any topic or subtopic will
  202. bring the text window to the front and display the text. A right mouse
  203. button click brings the lister back to front, and clears the text
  204. window, ready for another topic to be selected. To Quit FastRead.gc,
  205. simply close either of the windows with their close gadget. 
  206.     A simple lister search facility is included. This consists of a
  207. string gadget at the top, with a button marked [
  208. ] next to it. This
  209. can be useful for very large documents, or for AmigaGuides which
  210. contain hundreds of nodes. By typing any character string into the
  211. string gadget, the first index item which matches will move to the top
  212. of the lister. The search is not case sensitive. For example, the
  213. 'Requirements' index item can be found in a long list by typing 'req,
  214. REQ, or reQ' into the string gadget. Clicking on the button marked [
  215. will move the next matching index item to the top of the lister.
  216.     Pressing the HELP key whilst the FastRead.gc lister window is
  217. active will load and display this text. Any document being read at the
  218. time will be kept and not need to be reloaded.
  219.     FastRead understands one icon tooltype - VTMACRO, which sets the
  220. default AmigaDOS or ARexx script to run when the [Macro] button is
  221. pressed in the ViewText window.
  222. @endnode 
  223. @node "   ViewText.g"
  224. VIEWTEXT.G
  225.     This is the text window part of FastRead.gc, but is a global file
  226. which can be used by either FastRead.gc or the user's program, and is
  227. used without FastRead.gc for online help. All calls concerning online
  228. help are made from the users program. ViewText.g is initially loaded
  229. from there, and displays the specific text patch requested. See the
  230. section on HelpDemo.gc for more information.
  231.     When the patch of text has been read, a click on the right mouse
  232. button closes ViewText.g. The ViewText.g window has a button strip
  233. along the top to the right, containing four buttons. These are
  234. described as follows...
  235. Macro - Opens a file requester and enables an AmigaDOS or ARexx script
  236.         to be run. If the VTMACRO tooltype is set in FastRead's icon,
  237.         this macro will run without opening the requester.
  238. Prev - This goes to the previous subject in the FastRead.gc lister and
  239.        displays it. When displaying online help, this button is
  240.        ghosted.
  241. Next - This goes to the next subject in the FastRead.gc lister and
  242.        displays it. When displaying online help, this button is
  243.        ghosted.
  244. Grab - Saves the piece of text currently being displayed in the
  245.        ViewText.g listview. A file requester will appear for the save
  246.        path and filename. This function is also accessible by pressing
  247.        CTRL-S.
  248. Quit - This quits completely when used in stand alone mode, for
  249.        reading complete documents. However, in online mode, the Quit
  250.        button simply closes the Viewtext.g window. This function is
  251.        also accessible by pressing CTRL-Q.
  252. @endnode 
  253. @node "   HelpDemo.gc"
  254. HELPDEMO.GC
  255.     This is a 'mock up' used to simulate the user's program, and to
  256. demonstrate how to get selected patches of text from the program's doc
  257. file to use as online help.
  258. HelpDemo.gc can be read in any text editor or viewer. (Recommended)
  259. Borrowing parts of HelpDemo.gc for your own project
  260. ===================================================
  261. Loading ViewText.g - After 'xOnLoad' are the lines...
  262.     extract fastread.gc guipath fre_path
  263.     assign GCHELP: $fre_path
  264.     delvar fre_path
  265. This grabs the path of HelpDemo.gc and makes a temporary assign. The
  266. full path of ViewText.g is GUIS:Tools/FastRead/ViewText.g, but the
  267. GCHELP: assign is used throughout for convenience. The next important
  268. line is...
  269.       GuiLoad GCHELP:ViewText.g
  270.     This loads ViewText.g without opening its window. Put a copy of
  271. that line in a similar position in your program.
  272. Specify your document - In the script of HelpDemo.gc you will find:
  273.      ; -----  The target document is named here ----
  274.      docname = GUIS:Docs/HelpSystem.txt
  275.     This puts the path and filename of the document into a variable
  276. called 'docname'. Include the same in your program, changing
  277. 'GUIS:Docs/HelpSystem.txt' to your document's path and filename.
  278.     Switching help mode on and off is done in this case by a checkbox,
  279. but can be done by almost any gadget you like. Near the top of the
  280. script is the line...
  281.     helpon = 0
  282. which sets the helpmode to off. It will remain off until the checkbox
  283. is selected. The 'helpon' variable is used later to test whether help
  284. has been switched on or off.
  285. Assign topics to gadgets - Find the patch of script which contains
  286.     ; ---- The button for the HelpDemo patch ----
  287.     This is where you will need the '.idx' file which belongs to your
  288. document. The index file is not actually used with online help, but
  289. the byte offset numbers that it contains are used to locate the text
  290. patch in your document. You will see the lines...
  291.     offset = "8639 1992"
  292.     gosub helpdemo.gc open
  293.     The actual numbers are not important here, since they will be the
  294. ones in the .idx file belonging to your document.
  295.     The first line puts the start and length offsets into a variable
  296. called offset. This variable is used later in the script by a
  297. subroutine called 'open', which does the biz. The second of the two
  298. lines jumps to the 'open' subroutine.
  299.     At the bottom of the HelpDemo.gc script you will see the
  300. subroutine as follows...
  301. ; ---------- This is the routine for opening the reader gui...
  302.     xroutine open
  303.     if $helpon = 0
  304.         return
  305.     elseif $helpon = 1
  306.         cli 'GUIS:C/WriteNode $docname $offset'    
  307.         guiopen viewtext.g
  308.         guiwindow viewtext.g front
  309.         lvuse viewtext.g 1
  310.         lvchange ram:guide.txt
  311.         stop
  312.     endif
  313. This subroutine is shared by all the gadgets that use online help. To
  314. go through it line by line...
  315.     if $helpon = 0
  316.         return    
  317.     If the helpmode has not yet been activated, go back to the routine
  318. of the gadget that called the 'open' subroutine and carry out any
  319. commands remaining there.
  320.     elseif $helpon = 1
  321.         cli 'GUIS:C/WriteNode $docname $offset'    
  322.     Alternatively, if the helpmode has been activated, run the
  323. WriteNode binary in GUIS:C, and send to it the document path and
  324. filename, and the offset (start and length) numbers.
  325.     WriteNode will grab the required text from the document, and
  326. create a file in the Ram Disk: called 'Guide.txt' which contains the
  327. text. See the section on the binaries for more information.
  328.       1  guiopen viewtext.g
  329.       2  guiwindow viewtext.g front
  330.       3  lvuse viewtext.g 1
  331.       4  lvchange ram:guide.txt
  332.       5  stop
  333. 1 - Open the reader window. 2 - Bring it to the front. 3 - Select its
  334. listview as the current one. 4 - Import the file 'Ram Disk:Guide.txt'
  335. into the listview and display it. 5 - Halt all operation and wait for
  336. the user. Read the HelpDemo.gc script for more information.
  337. @endnode 
  338. @node "Rogues' Gallery"
  339. AUTHORS
  340.     The Gui4Cli Help System was written as a joint project between
  341. Graham Maddox of the UK and John Collett of New Zealand.
  342. Graham Maddox - The concept and all Gui4Cli scripts.
  343. <gmaddox@netcentral.co.uk>
  344. John Collett - Document format concept and most of the development.
  345. <jcollett@waikato.ac.nz>
  346. Dimitris C. Keletsekis - Kindly supplied the binary engines.
  347. <dck@hol.gr>
  348. @endnode 
  349.